Repository navigation
feat: photograph pages that are not gnoweb, and wait for the ones that draw themselves - #1
Merged
Merged
Conversation
…t draw themselves
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Two of them, found while pointing this service at the apps people actually
build on gno.land rather than only at realms.
1. "No selector matched" means two different things, and the code knew only one.
On gnoweb it means an error page, which is what
matched=statusrecords and whya placeholder tile is served instead of a screenshot. On somebody else's app it
means nothing at all: the chain is gnoweb's own class names. So every working
third-party site was classified as an error page and served a "NO PREVIEW" tile.
2.
fonts.readyplus two frames is not a painted page.It is enough for gnoweb, which server-renders and then hydrates. It is not
enough for a page that paints nothing until its JavaScript has fetched and
rendered. Measured 2026-09-23, page mode, all three answering 200 with real
content in a browser:
A confident picture of a spinner is worse than no picture, because nothing
downstream can tell the two apart.
What this adds
-allow-site, a second host list, empty by default. A host on it skips theselector chain, is photographed whole, and records
matched=site. The ladder isalready derived from the page master when there is no render master, so
size=thumbandsize=oganswer normally with no further change.A DOM-quiesce settle, after the existing font wait: resolve once there have
been no mutations for 400 ms, or at a 2,500 ms cap.
Three things worth reviewing
The settle is a quiesce, not a sleep or network idle. A fixed sleep taxes
every gnoweb capture for the handful that need it, and the sweep runs over every
realm on the chain. Network idle never arrives on a page holding a websocket or
a poll open, and several of these do. A quiesce returns in one quiet window on a
page that was already finished.
Verified it changes nothing for gnoweb. Same three pages, render mode,
before and after, byte-for-byte:
/r/gov/daomd-renderer.c-realm-view/r/gnoland/blogmd-renderer.c-realm-view/p/moul/txlinkarticle.b-directoryThe cost is the quiet window: 970 ms to 1.28 s on
/r/gov/dao.The two lists are kept apart on purpose. The operator states which kind of
page a host serves rather than the service guessing from what it found. A host
in both is a configuration mistake with a quiet failure mode (the picture
silently gets worse, because the whole-page path replaces a crop the chain would
have found), so gnoweb wins and there is a test on it.
The site path does not touch the page it photographs.
resolveJSpads theelement it matches so the crop has breathing room; doing that to a third-party
document would be photographing something that never existed. The site path runs
a script that only reads the document height.
Verified end to end
Against a local
servewith-allow-site adena.app,gnoswap.io,kourt.xyz: allthree return
matched=site, a full rung ladder, and200onsize=thumbandsize=ogafter the first capture drains the queue (202with a tile beforethat, as designed). adena.app
thumb@2xis 3,946 bytes andog20,616.go test ./...,gofmt -l .,go vet ./...clean.